#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H

#include "ElaContentDialog.h"
#include "ElaText.h"
#include "ElaCheckBox.h"
#include "ElaComboBox.h"
#include <QVBoxLayout>
#include <QButtonGroup>
#include <QRadioButton>
#include <QDebug>

class SettingsDialog : public ElaContentDialog
{
    Q_OBJECT
  public:
    SettingsDialog(QWidget* parent) : ElaContentDialog(parent)
    {
        setWindowTitle("应用设置");

        auto* contentWidget = new QWidget();
        auto* layout = new QVBoxLayout(contentWidget);

        auto* title = new ElaText("应用设置", this);
        title->setTextStyle(ElaTextType::Title);
        layout->addWidget(title);
        layout->addSpacing(20);

        // 主题设置
        auto* themeGroup = new QButtonGroup(this);
        auto* lightTheme = new QRadioButton("浅色主题", this);
        auto* darkTheme = new QRadioButton("深色主题", this);
        auto* autoTheme = new QRadioButton("自动主题", this);

        themeGroup->addButton(lightTheme);
        themeGroup->addButton(darkTheme);
        themeGroup->addButton(autoTheme);
        autoTheme->setChecked(true);

        layout->addWidget(new QLabel("主题设置:"));
        layout->addWidget(lightTheme);
        layout->addWidget(darkTheme);
        layout->addWidget(autoTheme);
        layout->addSpacing(15);

        // 其他设置
        auto* autoSave = new ElaCheckBox("自动保存", this);
        auto* notifications = new ElaCheckBox("启用通知", this);
        notifications->setChecked(true);

        layout->addWidget(autoSave);
        layout->addWidget(notifications);
        layout->addStretch();

        setCentralWidget(contentWidget);

        // 设置按钮文本
        setLeftButtonText("重置");
        setMiddleButtonText("默认");
        setRightButtonText("保存");

        resize(450, 350);
    }

  protected:
    void onLeftButtonClicked() override
    {
        qDebug() << "重置所有设置为默认值";
        // 实现重置逻辑
    }

    void onMiddleButtonClicked() override
    {
        qDebug() << "恢复默认设置";
        // 实现恢复默认逻辑
    }

    void onRightButtonClicked() override
    {
        qDebug() << "保存设置并关闭";
        // 实现保存逻辑
        // 父类会自动关闭
    }
};

#endif  // SETTINGSDIALOG_H